package com.uzhie.jt808.msg.entity.JT_200;

import java.nio.charset.Charset;

/**
 * Created by TangFei on 2018/10/6.
 * 苏标 高级驾驶辅助系统报警 0x64
 */
public class JS_DrivingAssistanceSystemWarn extends JS_SuperWarn {

    private int flagStatus;
    private int type;
    private int level;
    private int frontSpeed;
    private int frontDest;
    private int speed;

    @Override
    public int getAdditionalId() {
        return 0X64;
    }

    @Override
    public byte getAdditionalLength() {
        return 0X30;
    }

    @Override
    public byte[] WriteToBytes() {
        return new byte[0];
    }

    @Override
    public void ReadFromBytes() {
        logger.trace("解析苏标 0X64 指令");
        // 报警ID
        int warnID = buffer.getInt();
        // 标志状态
        flagStatus = buffer.get();
        // 报警/事件类型
        type = buffer.get();
        // 报警级别
        level = buffer.get();
        // 前车车速
        frontSpeed = buffer.get();
        // 前车/行人距离
        frontDest = buffer.get();
        // 偏离类型
        byte deviateType = buffer.get();
        // 道路标志识别类型
        byte guidepostType = buffer.get();
        // 道路标志识别数据
        byte guidepostData = buffer.get();
        // 车速
        speed = buffer.get();
        // 高程
        short altitude = buffer.getShort();
        // 纬度
        latitude = buffer.getInt();
        // 经度
        longitude = buffer.getInt();
        // 日期时间
        time = readBCDTime();
        // 车辆状态
        short vehicleStatusShort = buffer.getShort();
        // 报警标识号
        // 终端ID
        byte[] devIDBytes = new byte[7];
        buffer.get(devIDBytes, 0, 7);
        String devID = new String(devIDBytes, Charset.forName("GBK"));
        // 时间
        String time2 = readBCDTime();
        // 序号
        byte serialNumber = buffer.get();
        // 附件数量
        byte enclosureNumber = buffer.get();
        // 保留字段
        buffer.get();
    }

    public int getFlagStatus() {
        return flagStatus;
    }

    public int getType() {
        return type;
    }

    public int getLevel() {
        return level;
    }

    public int getFrontSpeed() {
        return frontSpeed;
    }

    public int getFrontDest() {
        return frontDest;
    }

    public int getSpeed() {
        return speed;
    }

}
